#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
using namespace std;

int main() {
    double l,h;
    cin>>l>>h;
    double cnt=0;
    double A=0;
    int n;
    cin>>n;
    double a,b,c;
    double tmp;
    for (int i=0; i<n; ++i) {
        cin>>a>>b>>c;
        tmp=abs(a-b);
        cnt+=tmp;
        A+=tmp*c;
    }
    cnt=h-cnt;
    double res=l/(A+cnt);
    printf("%0.9lf\n", res);
    return 0;
}
